// 4. 抽象
#include <iostream>
using namespace std;

// 抽象类
class Shape {
public:
    // 纯虚函数
    virtual void draw() = 0;
};

// 派生类
class Circle : public Shape {
public:
    void draw() override {
        cout << "Drawing a circle." << endl;
    }
};

// 派生类
class Rectangle : public Shape {
public:
    void draw() override {
        cout << "Drawing a rectangle." << endl;
    }
};

int main() {
    // Shape shape;  // 错误：不能实例化抽象类

    Circle circle;
    Rectangle rectangle;

    circle.draw();    // 输出: Drawing a circle.
    rectangle.draw(); // 输出: Drawing a rectangle.

    return 0;
}
